var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")), _asyncToGenerator2 = require("@babel/runtime/helpers/asyncToGenerator"), _host = _interopRequireDefault(require("/host.js")), _language = _interopRequireDefault(require("/utils/language.js")), _logs = _interopRequireDefault(require("utils/logs")), _require = require("./utils/themeSkin/getSkinSetting"), getSkinSettings = _require.getSkinSettings, QQMapWX = require("/mymap/qqmap-wx-jssdk.min.js"), qqmapsdk, yzFirstlogin = 1, yzValidate_page = 1, livePlayer = null;

try {
    livePlayer = requirePlugin("live-player-plugin");
} catch (e) {}

var loginTap = !1;

App({
    data: {
        host: _host.default.host,
        uniacid: _host.default.uniacid,
        basic_info: {},
        validate_page: {},
        front_accept_message_id: "wx446c12387876992d",
        front_mini_programs_id: "wxf90477356b51ec91",
        accept_message_id: "wxa0ecf1f5513abab3",
        mini_programs_id: "wxf90477356b51ec91",
        clearlogin: null,
        login_type: 1,
        login_fun_list: [],
        address_code: ""
    },
    onLaunch: function(e) {
        var t = this, a = this;
        wx.getSystemInfo({
            success: function(e) {
                t.globalData.statusBarHeight = e.statusBarHeight, t.globalData.navBarHeight = 44 + e.statusBarHeight;
            }
        }), this._getLanguage(_language.default), this.globalData.vid = null;
        try {
            wx.removeStorageSync("tempIndex"), wx.removeStorageSync("iPhoneBottom"), wx.removeStorageSync("deliverId");
        } catch (e) {}
        try {
            e.query ? (console.log(e, "options1"), this.seyzredirect(e.path, e.query), e.query.store_alone_id && (this.globalData.STORE_ID = e.query.store_alone_id, 
            this.globalData.store_alone_temp = 1), e.query.dyID && this.setDeliver(e)) : this.seyzredirect(e.path);
        } catch (e) {
            console.log(e);
        }
        if (e.query.mid && this._setMid(e.query.mid), e.query && e.query.scene) {
            var n = decodeURIComponent(e.query.scene);
            if (n) {
                var o = [];
                o = n.split(",");
                for (var i = 0; i < o.length; i++) {
                    var r;
                    "mid" == (r = o[i].split("="))[0] && this._setMid(r[1]);
                }
            }
        }
        this.gotochecklogin(e), this.getSystemInfo();
        try {
            wxfaceapp.checkWxFacePayOsInfo({
                success: function(e) {
                    console.log("1111111::::::", e.screenInfo), "back-screen" == e.screenInfo && (wxfaceapp.onRemoteMessage(function(e) {
                        if (e.content) {
                            var t = JSON.parse(e.content);
                            t.redirectType && ("succeededPayment" == t.redirectType ? wx.redirectTo({
                                url: "/packageC/frogpro/succeededPayment/succeededPayment?money=" + t.money
                            }) : "login" == t.redirectType ? wx.redirectTo({
                                url: "/packageC/frogpro/backScreenlogin/backScreenlogin"
                            }) : "lose" == t.redirectType ? wx.redirectTo({
                                url: "/packageC/frogpro/lose/lose?money=" + t.money
                            }) : "waitingPayment" == t.redirectType && wx.redirectTo({
                                url: "/packageC/frogpro/waitingPayment/waitingPayment?money=" + t.money
                            }));
                        }
                    }), a.startLogin());
                },
                fail: function(e) {}
            });
        } catch (e) {}
        console.log(this.globalData.STORE_ID, "STORE_ID=============>>>>>>>>>>"), this.overShare(), 
        wx && wx.setInnerAudioOption && wx.setInnerAudioOption({
            obeyMuteSwitch: !1,
            success: function(e) {
                console.log("开启静音模式下播放音乐的功能");
            },
            fail: function(e) {
                console.log("静音设置失败");
            }
        });
    },
    _getNetWork: function(e) {
        return this._Request(e, "GET");
    },
    _postNetWork: function(e) {
        return this._Request(e, "POST");
    },
    _Request: function(e, t) {
        var a = this;
        return new Promise(function(n, o) {
            e.resolve = n, e.reject = o, e.method = t, 1 == a.data.login_type ? a.toRequestNetWork(e) : a.data.login_fun_list.push(e);
        });
    },
    getTimeLeft(datetimeTo) {
      // 计算目标与现在时间差（毫秒）
      let time1 = new Date(datetimeTo).getTime()
      let time2 = new Date().getTime()
    //   console.log(time2)
      let mss = datetimeTo - time2;
      let days = parseInt(time1 / (1000 * 60 * 60 * 24))
      let hours = parseInt((time1 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
      let minutes = parseInt((time1 % (1000 * 60 * 60)) / (1000 * 60))
      let seconds = parseInt((time1 % (1000 * 60)) / 1000)
      let obj = {
        day: days < 10 ? "0" + days : days,
        hour: hours < 10 ? "0" + hours : hours,
        minute: minutes < 10 ? "0" + minutes : minutes,
        second: seconds < 10 ? "0" + seconds : seconds,
        mss: time1,
      }
      return obj
    },
    toRequestNetWork: function(e) {
        var t = this, a = e.url, n = e.resolve, o = e.reject, i = e.method, r = e.data || {}, s = e.data, l = e.success, c = e.fail, d = e.complete, g = 2 != e.validateBol, u = !0;
        "boolean" == typeof e.showToastIn && (u = e.showToastIn);
        var p = this;
        u && wx.showNavigationBarLoading();
        var _ = "", m = "";
        try {
            var f = wx.getStorageSync("session");
            f && (_ = f);
        } catch (e) {
            console.log(e);
        }
        try {
            var h = wx.getStorageSync("wx_token");
            h && (m = h);
        } catch (e) {
            console.log(e);
        }
        if (0 === yzFirstlogin && 1 === yzValidate_page && ("0" == r.not_validate_page && r || (a += "&validate_page=1")), 
        (1 === yzFirstlogin && a.indexOf("member.login.index") < 0 && a.indexOf("member.member.wxJsSdkConfig") < 0 || a.indexOf("finance.income-page.index") >= 0) && (a += "&basic_info=1&validate_page=1"), 
        a.indexOf("home-page.index") > 0 && (a += "&scope=home"), "GET" === i && s) {
            var y = [];
            Object.keys(s).forEach(function(e) {
                return y.push(e + "=" + s[e]);
            }), a += "&" + y.join("&");
        }
        a += "&app_type=wechat", a += "&3rd_session=" + _, 1 == this.globalData.store_alone_temp && (a += "&store_id=" + this.globalData.STORE_ID), 
        console.log(i, "请求中Url:", a);
        var b = {
            "Content-Type": "application/json",
            Accept: "application/json",
            Cookie: "PHPSESSID=" + m
        };
        if (2 != this.globalData.new_page_comeIn) {
            var v = getCurrentPages(), x = v[v.length - 1];
            b["local-url"] = x.route, this.globalData.new_page_comeIn = 2;
        }
        a += "&mini_version=v1.1.139", this.data.login_type = 2, wx.request({
            url: a,
            method: i,
            data: r,
            header: b,
            timeout: 1e4,
            success: function(a) {
                if (a.data.basic_info) {
                    getSkinSettings({
                        themeBaseColor: a.data.basic_info.theme_color
                    }), yzFirstlogin = 0, p.data.basic_info = a.data.basic_info, p.initLanguage(p.data.basic_info.lang);
                    try {
                        wx.setStorageSync("yz_basic_info", a.data.basic_info);
                        var o = a.data.basic_info;
                        if (o.plugin_setting && o.plugin_setting.store_alone_temp && 1 == o.plugin_setting.store_alone_temp.enable) {
                            t.globalData.store_alone_temp = 1;
                            var i = getCurrentPages(), r = i[i.length - 1];
                            t.globalData.STORE_ID || "packageG/independent_store/index/index" === r.route || ("packageA/detail_v2/detail_v2" == r.route && "store_goods" == a.data.data.goods_type && a.data.data.get_store_info ? t.globalData.STORE_ID = a.data.data.get_store_info.store_id : t.isHasStoreId());
                        }
                        t.globalData.cart_num = a.data.basic_info.globalParameter ? a.data.basic_info.globalParameter.cart_num : "", 
                        a.data.basic_info.home && a.data.basic_info.home.mailInfo && a.data.basic_info.home.mailInfo && wx.setStorageSync("integral", a.data.basic_info.home.mailInfo.credit1 || "积分");
                    } catch (e) {
                        console.log("yz_basic_info存储出错", e);
                    }
                    try {
                        a.data.basic_info.home.plugin.new_member_prize && a.data.basic_info.home.plugin.new_member_prize.prize && 0 != a.data.basic_info.home.plugin.new_member_prize.prize.length && (console.log("storage_newAward存储===="), 
                        wx.setStorageSync("storage_newAward", a.data.basic_info.home.plugin.new_member_prize));
                    } catch (e) {
                        console.log("storage_newAward存储出错", e);
                    }
                }
                if (g && a.data.validate_page && p.getInvite(a.data.validate_page), 0 != a.data.result || "请登录" !== a.data.msg) {
                    if (0 != a.data.result || p._isTextEmpty(a.data.data) || p.taskRoute(a), 2 == a.data.result) wx.removeStorage({
                        key: "session",
                        success: function(e) {
                            console.log(e.data);
                        }
                    }), wx.removeStorage({
                        key: "openid",
                        success: function(e) {
                            console.log(e.data);
                        }
                    }), wx.removeStorage({
                        key: "wx_token",
                        success: function(e) {
                            console.log(e.data);
                        }
                    }), wx.removeStorage({
                        key: "userInfo",
                        success: function(t) {
                            p._getNetWork(e);
                        }
                    }); else if (wx.hideNavigationBarLoading(), l && l(a), n(a), t.data.login_type = 1, 
                    t.data.login_fun_list.length > 0) {
                        var s = t.data.login_fun_list.shift();
                        t.toRequestNetWork(s);
                    }
                } else p.login_state(e, "get");
            },
            fail: function(e) {
                t.data.login_type = 1, c && "function" == typeof c && c(e), o(e), wx.showToast({
                    title: "数据获取失败！",
                    icon: "loading",
                    duration: 2e3,
                    mask: !0
                }), _logs.default.error("----------app.js->wx.request->fail-----------", e, a), 
                console.log("数据获取失败:", a, e);
            },
            complete: function(e) {
                d && "function" == typeof d && d(e);
            }
        });
    },
    taskRoute: function(e) {
        if (0 == e.data.result && (-1 == e.data.data.task_package_invite_code || -1 == e.data.data.task_package_real_name_auth) && ("-1" == e.data.data.task_package_invite_code && wx.navigateTo({
            url: "/packageI/taskPackage/middle/middle"
        }), "-1" == e.data.data.task_package_real_name_auth)) {
            var t = getCurrentPages(), a = t[t.length - 1].route;
            wx.setStorageSync("real_name_redirect", a), wx.navigateTo({
                url: "/packageH/signPage/personBank/personBank?from=bindRealName"
            });
        }
    },
    requestFrogproServerData: function(e, t, a) {
        return new Promise(function(n, o) {
            wx.request({
                url: e,
                data: a,
                header: {
                    "Content-Type": "application/json",
                    Accept: "application/json"
                },
                method: t,
                success: function(e) {
                    n(e);
                },
                fail: function(e) {
                    o(e);
                }
            });
        });
    },
    startLogin: function() {
        var e = this;
        e.data.clearlogin = setInterval(function() {
            wx.login({
                success: function(t) {
                    t.code ? e.requestFrogproServerData(e.getFrogproNetAddresss("member.login.index"), "get", {
                        code: t.code,
                        ver: "2"
                    }).then(function(t) {
                        var a = t.data;
                        if (1 == a.result) {
                            a.data.user_info && wx.setStorageSync("nickname", a.data.user_info.nickname), a.msg.session && wx.setStorageSync("session", a.session), 
                            a.msg.wx_token && wx.setStorageSync("wx_token", a.wx_token), a.data.store && wx.setStorageSync("storeMessage", a.data.store);
                            var n = {
                                wx_token: a.msg.wx_token,
                                session: a.msg.session,
                                store_id: a.data.store.store_id,
                                dispatch_type_id: 2,
                                goods_id: a.data.store.goods_id,
                                host: e.data.host,
                                uniacid: e.data.uniacid
                            };
                            wxfaceapp.postMsg({
                                targetAppid: e.data.accept_message_id,
                                content: JSON.stringify(n),
                                success: function(e) {},
                                fail: function(e) {}
                            });
                        } else console.log("错误信息:::" + t.errMsg);
                    }).catch(function(e) {
                        console.log("错误信息:::" + e.errMsg);
                    }) : console.log("错误信息:::" + res.errMsg);
                },
                fail: function(e) {
                    console.log("登录失败，请求被拒绝！获取用户登录态失败！" + e);
                }
            });
        }, 6e5);
    },
    getFrogproNetAddresss: function(e) {
        var t = this.getWxToken();
        return this.data.host + "/addons/yun_shop/api.php?i=" + this.data.uniacid + "&session_id=" + t + "&type=12&route=" + e;
    },
    getSystemInfo: function() {
        try {
            var e = wx.getSystemInfoSync().model;
            if (/iPhone X/i.test(e) || /iPhone 11/i.test(e) || /iPhone 12/i.test(e) || /iPhone 13/i.test(e) || /iPhone 14/i.test(e)) try {
                wx.setStorageSync("iPhoneBottom", e);
            } catch (e) {
                console.log(e);
            }
        } catch (e) {}
    },
    onShow: function(e) {
        var t = this;
        yzFirstlogin = 1, yzValidate_page = 1, this.data.login_type = 1, this._getTemplate(), 
        e.query && e.query.custom_params && this._setMid(JSON.parse(decodeURIComponent(e.query.custom_params)).mid);
        console.log(e, "onShow"), livePlayer && [ 1007, 1008, 1014, 1044, 1045, 1046, 1047, 1048, 1049, 1073, 1154, 1155 ].indexOf(e.scene) > -1 && livePlayer.getShareParams().then(function(e) {
            console.log("get room id", e.room_id), console.log("get custom params", e.custom_params), 
            t._setMid(e.custom_params.mid);
        }).catch(function(e) {
            console.log("get share params", e);
        }), e.referrerInfo && e.referrerInfo.extraData && (this.globalData.integralOtherMiniData = e.referrerInfo.extraData || {}), 
        e.query.store_alone_id && (this.globalData.STORE_ID = e.query.store_alone_id, this.globalData.store_alone_temp = 1);
    },
    onHide: function() {
        wx.removeStorageSync("firstAdvertisement"), wx.removeStorageSync("fullAdvertisement"), 
        wx.removeStorageSync("popAdvertisement"), wx.removeStorageSync("page_idFull_screens"), 
        wx.removeStorageSync("page_idAdvertisings"), wx.removeStorageSync("address-point"), 
        wx.removeStorageSync("home_onUnload"), wx.removeStorageSync("new_decorate");
    },
    seyzredirect: function(e, t) {
        console.log(e, t, t.scene, "options2");
        const arr = t.scene;
        this.globalData.newArr = arr.slice(6);
        console.log(this.globalData.newArr);
        
        var a = getCurrentPages(), n = a[a.length - 1], o = t || (e ? "" : n.options), i = e || n.route;
        if (!([ "pages/login/login", "packageA/member/editmobile/editmobile" ].indexOf(i) > -1)) if (o) {
            var r = i + "?";
            for (var s in o) {
                r += s + "=" + o[s] + "&";
            }
            r = r.substring(0, r.length - 1), wx.setStorageSync("yz_redirect", "".concat(r));
        } else wx.setStorageSync("yz_redirect", i);
    },
    getyzredirect: function() {
        var e = "";
        try {
            var t = wx.getStorageSync("yz_redirect");
            t && (e = t);
        } catch (e) {
            console.log(e);
        }
        return e;
    },
    globalData: {
        host: _host.default.host,
        uniacid: _host.default.uniacid,
        new_page_comeIn: 0,
        statusBarHeight: 0,
        screenHeight: 0,
        define_order_pay: 1,
        define_order_receiv: 5,
        define_order_check: 8,
        define_order_cancle: 9,
        define_order_comment: 10,
        define_order_recomment: 11,
        define_order_delete: 12,
        define_order_refund: 13,
        define_order_used: 14,
        mid: 0,
        userInfo: null,
        globaSession: null,
        tabBar: {
            index: "-1",
            category: "-1",
            extension: "-1",
            cart: "-1",
            memindex: "-1"
        },
        qqmapkey: "",
        qqmapsig: "",
        pathData: "",
        cart_num: 0,
        isLocationIng: !1,
        store_alone_temp: 0,
        STORE_ID: 0,
        integralOtherMiniData: {},
        beforeBindMobilePage: "",
        newArr:[],
    },
    onLoad: function () {

        // 实例化API核心类
        qqmapsdk = new QQMapWX({
            key: 'RP6BZ-JMCCC-DY32R-A765N-Z3ULO-FZFQI'
        });
        console.log('zheli--------------------------------',qqmapsdk)
    },
    _getLanguage: function(e) {
        wx.setStorageSync("langIndex", e);
    },
    _getTemplate: function() {
        var e = this, t = this.getNetAddresss("plugin.min-app.Frontend.Controllers.page.index");
        return t += "&scope=pass", new Promise(function(a, n) {
            wx.request({
                url: t,
                method: "GET",
                header: {
                    "Content-Type": "application/json",
                    Accept: "application/json"
                },
                success: function(t) {
                    var n = t.data;
                    if (1 === n.result) {
                        e.globalData.qqmapkey = n.data.qq_map_web_key, e.globalData.qqmapsig = n.data.qq_map_web_sign;
                        try {
                            wx.setStorageSync("new_agreement", {
                                agreement_name: n.data.agreement_name,
                                new_agreement: n.data.new_agreement
                            });
                        } catch (e) {
                            console.log(e);
                        }
                        a();
                    } else e.globalData.qqmapkey = "KUBBZ-IXPCO-3ZNWD-SHC4H-O4TZH-ZSBQR", e.globalData.qqmapsig = "l3Fyt4WylOFiPzbBSIkjWJ1aDU6NNa4", 
                    a();
                },
                fail: function(t) {
                    e.globalData.qqmapkey = "KUBBZ-IXPCO-3ZNWD-SHC4H-O4TZH-ZSBQR", e.globalData.qqmapsig = "l3Fyt4WylOFiPzbBSIkjWJ1aDU6NNa4", 
                    a();
                }
            });
        });
    },
    _setMid: function(e) {
        this.globalData.mid = e, wx.setStorage({
            key: "mid",
            data: e
        });
    },
    _setshopid: function(e) {
        this.globalData.shop_id = e, wx.setStorage({
            key: "shop_id",
            data: e
        });
    },
    _setvid: function(e) {
        this.globalData.vid = e;
    },
    _setcircleInvitationId: function(e) {
        console.log("设置了circle_invitation_id"), this.globalData.circle_invitation_id = e;
    },
    _setroomid: function(e) {
        this.globalData.roomid = e;
    },
    isHasStoreId: function() {
        var e = this, t = this.getNetAddresss("plugin.store-alone-temp.frontend.home.history-store");
        this._getNetWork({
            url: t,
            success: function(t) {
                var a = t.data;
                1 == a.result ? (e.globalData.STORE_ID = a.data.store_id || 0, e.globalData.STORE_ID ? wx.reLaunch({
                    url: "/packageG/independent_store/index/index?store_id=" + e.globalData.STORE_ID
                }) : wx.reLaunch({
                    url: "/packageG/independent_store/access_tip/access_tip"
                })) : wx.showToast({
                    title: a.msg,
                    icon: "none",
                    duration: 1500,
                    success: function(e) {
                        setTimeout(function() {
                            wx.reLaunch({
                                url: "/packageG/independent_store/access_tip/access_tip"
                            });
                        }, 1200);
                    }
                });
            }
        });
    },
    getWxToken: function() {
        var e = wx.getStorageSync("wx_token");
        if (e) return console.log("同步token", e), e;
        console.log("获取token失败");
    },
    getNetAddresss: function(e) {
        this.getExtJson();
        var t = this.data.host + "/addons/yun_shop/api.php?i=" + this.data.uniacid + "&type=2&route=" + e;
        return this.globalData.mid && (t += "&mid=" + this.globalData.mid), this.globalData.vid && (t += "&vid=" + this.globalData.vid), 
        this.globalData.circle_invitation_id && (console.log("地址带上circle_invitation_id"), 
        t += "&circle_invitation_id=" + this.globalData.circle_invitation_id), this.globalData.roomid && (t += "&room_id=" + this.globalData.roomid), 
        this.globalData.shop_id && (t += "&shop_id=" + this.globalData.shop_id), (t += "&ingress=weChatApplet").indexOf("member.login.index") > -1 && (yzFirstlogin = 1), 
        console.log("APP____URL:::", t), t;
    },
    getTimeDifference: function(e) {
        var t = Date.parse(new Date()), a = e < 1e12 ? 1e3 * e : e;
        return a - t > 0 ? a - t : a - t <= 0 ? 0 : void 0;
    },
    getEvaluate: function(e) {
        return {
            num: e,
            list: [ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ].slice(5 - e, 10 - e)
        };
    },
    _isTextEmpty: function(e) {
        return null == e || "" == e || null == e;
    },
    isIosOrAndroid: function() {
        var e = navigator.userAgent, t = "";
        return (e.indexOf("Android") > -1 || e.indexOf("Adr") > -1) && (t = "android"), 
        !!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) && (t = "ios"), t;
    },
    setMailLanguage: function(e, t) {
        return this._isTextEmpty(t) ? e : t;
    },
    _isMoblie: function(e) {
        return isNaN(Number(e));
    },
    _isMid: function(e, t) {
        if (e.indexOf("mid=") >= 0) return this.changeUrlArg(e, "mid", t);
        var a = this.delQueStr(e, "mid");
        return this.changeUrlArg(a, "mid", t);
    },
    changeUrlArg: function changeUrlArg(url, arg, val) {
        var pattern = arg + "=([^&]*)", replaceText = arg + "=" + val;
        return url.match(pattern) ? url.replace(eval("/(" + arg + "=)([^&]*)/gi"), replaceText) : url.match("[?]") ? url + "&" + replaceText : url + "?" + replaceText;
    },
    delQueStr: function(e, t) {
        var a = "";
        if (-1 == e.indexOf("#")) return e;
        var n = "", o = "";
        if (-1 != (a = e.substr(e.indexOf("#") + 1)).indexOf("&")) {
            n = a.split("&");
            for (var i = 0; i < n.length; i++) n[i].split("=")[0] != t && (o = o + n[i].split("=")[0] + "=" + n[i].split("=")[1] + "&");
            return e.substr(0, e.indexOf("?")) + "?#" + o.substr(0, o.length - 1);
        }
        return (n = a.split("="))[0] == t ? e.substr(0, e.indexOf("?")) : e;
    },
    getExtJson: function() {
        console.log("================enter extJson===============");
        var e = this, t = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
        console.log("********extConfig*********", t), t.host ? (console.log("================extJson exists==============="), 
        e.data.host = t.host, e.data.uniacid = t.uniacid) : (console.log("================extJson not exists==============="), 
        wx.getExtConfigSync({
            success: function(t) {
                console.log("================extJson11===============", t.extConfig), e.data.host = t.extConfig.host, 
                e.data.uniacid = t.extConfig.uniacid;
            },
            fail: function(e) {
                console.log("================error.extJson11===============", e);
            }
        }));
    },
    getInvite: function(e) {
        var t = this;
        return _asyncToGenerator2(_regenerator.default.mark(function a() {
            return _regenerator.default.wrap(function(a) {
                for (;;) switch (a.prev = a.next) {
                  case 0:
                    return 1 !== e.is_invite && 1 !== e.invite_mobile || 1 !== e.real_name_auth_is_open || 1 !== e.is_auth || !e.bind_address || 1 != e.bind_address.is_bind_address || (yzValidate_page = 0), 
                    a.next = 3, t.bindMobile(e.is_bind_mobile, e.bind_mobile_page).then(function(a) {
                        t.bindInviter(e).then(function(a) {
                            t.bind_real_name(e).then(function(a) {
                                e.bind_address && t.setAddress(e).then(function(e) {}).catch(function(e) {
                                    e.url && wx.showModal({
                                        title: "请设置默认地址",
                                        content: "",
                                        showCancel: !1,
                                        confirmText: "去设置",
                                        success: function(e) {
                                            wx.reLaunch({
                                                url: "/packageD/member/addressList/addressList"
                                            });
                                        }
                                    });
                                });
                            }).catch(function(e) {
                                e.url && wx.reLaunch({
                                    url: e.url
                                });
                            });
                        }).catch(function(e) {
                            e.url && (t.setBeforeBindMobilePage(), wx.reLaunch({
                                url: e.url
                            }));
                        });
                    }).catch(function(e) {
                        e.url && (t.setBeforeBindMobilePage(), wx.reLaunch({
                            url: e.url
                        }));
                    });

                  case 3:
                  case "end":
                    return a.stop();
                }
            }, a);
        }))();
    },
    setAddress: function(e) {
        var t = e.bind_address.bind_address_type, a = e.bind_address.bind_address_page, n = getCurrentPages(), o = n[n.length - 1].route, i = a;
        return new Promise(function(a, n) {
            "packageD/member/addressList/addressList" != o && "packageD/member/addressAdd_v2/addressAdd_v2" != o && "pages/login/login" != o ? 1 != e.bind_address.is_bind_address ? (1 == t ? a({
                url: "/packageD/member/addressList/addressList"
            }) : 2 == t && i.forEach(function(e, t) {
                ("member_center" == e && "packageG/member_v2/member_v2" == o || "goods_detail" == e && o.indexOf("detail_v2/detail_v2") > 0 || "promotion_center" == e && "packageG/pages/member/extension/extension" == o) && n({
                    url: "/packageD/member/addressList/addressList"
                });
            }), a()) : a() : n();
        });
    },
    bindMobile: function(e, t) {
        var a = getCurrentPages(), n = a[a.length - 1].route, o = t;
        return new Promise(function(t, a) {
            "packageA/member/editmobile/editmobile" != n ? 0 !== e ? (1 == e ? a({
                url: "/packageA/member/editmobile/editmobile?fromApp=1"
            }) : 2 == e && o.forEach(function(e, t) {
                "member_center" == e ? "packageG/member_v2/member_v2" == n && a({
                    url: "/packageA/member/editmobile/editmobile?fromApp=2"
                }) : "goods_detail" == e ? n.indexOf("detail_v2/detail_v2") > 0 && a({
                    url: "/packageA/member/editmobile/editmobile?fromApp=1"
                }) : "promotion_center" == e && "packageG/pages/member/extension/extension" == n && a({
                    url: "/packageA/member/editmobile/editmobile?fromApp=4"
                });
            }), t()) : t() : a();
        });
    },
    bindInviter: function(e) {
        var t = getCurrentPages(), a = t[t.length - 1].route;
        return new Promise(function(t, n) {
            if ("packageC/member/visit/Inviter/Inviter" != a) if (1 === e.is_login) {
                if (1 !== e.is_invite) {
                    if (1 === e.invite_page) return void n({
                        url: "/packageC/member/visit/Inviter/Inviter"
                    });
                } else if (void 0 !== e.invite_mobile && 1 !== e.invite_mobile && 1 === e.invite_page) return void n({
                    url: "/packageC/member/visit/Inviter/Inviter"
                });
                t();
            } else t(); else n();
        });
    },
    setBeforeBindMobilePage: function() {
        var e = getCurrentPages(), t = e[e.length - 1], a = t.route;
        t.options && t.options.scene ? this.globalData.beforeBindMobilePage = a + "?scene=" + t.options.scene : this.globalData.beforeBindMobilePage = a;
    },
    bind_real_name: function(e) {
        var t = getCurrentPages(), a = t[t.length - 1], n = a.route;
        return new Promise(function(t, o) {
            if ("packageH/signPage/personBank/personBank" == n || "packageD/buy/orderPay/orderPay" == n && "auth" == a.options.tag) o(); else {
                if (1 === data.real_name_auth_is_open && 1 !== data.is_auth && data.real_name_auth_scene && data.real_name_auth_scene.length > 0) {
                    console.log("实名插件开启=========="), wx.setStorageSync("real_name_redirect", n);
                    var i = e.indexOf("1") > -1 && "packageH/signPage/personBank/personBank" !== n, r = e.indexOf("5") > -1 && "packageG/pages/member/extension/extension" == n, s = e.indexOf("2") > -1 && "packageA/member/withdrawal/withdrawal" == n, l = e.indexOf("3") > -1 && ("packageC/video_goods/videoAgreement/videoAgreement" == n || "packageC/video_goods/releaseVideo/releaseVideo" == n), c = e.indexOf("4") > -1 && "packageC/micro_communities/microRelease/microRelease" == n, d = e.indexOf("6") > -1 && "packageA/member/supplier/supplier" == n, g = e.indexOf("7") > -1 && "packageA/member/storeApply/storeApply" == n && "{}" == JSON.stringify(a.options), u = e.indexOf("8") > -1 && "packageA/member/storeApply/storeApply" == n && a.options && "hotelApply" == a.options.name, p = e.indexOf("9") > -1 && "packageD/directSeeding/anchorApply/anchorApply" == n;
                    if (i || r || s || l || l || c || c || d || g || u || p) return void o({
                        url: "/packageH/signPage/personBank/personBank?from=bindRealName"
                    });
                    t();
                }
                t();
            }
        });
    },
    requestServerData: function(e, t, a) {
        return e.indexOf("member.login.index") > -1 && console.log("登录接口"), new Promise(function(n, o) {
            wx.request({
                url: e,
                data: a,
                header: {
                    "Content-Type": "application/json",
                    Accept: "application/json"
                },
                method: t,
                success: function(e) {
                    n(e);
                },
                fail: function(e) {
                    o(e);
                }
            });
        });
    },
    login_state: function(e, t) {
        var a = this;
        wx.login({
            success: function(t) {
                wx.showLoading({
                    title: "自动登录中...."
                }), t.code ? a.requestServerData(a.getNetAddresss("member.login.index"), "get", {
                    code: t.code,
                    ver: "2"
                }).then(function(t) {
                    wx.hideLoading();
                    var n = t.data;
                    a.data.login_type = 1, 1 == n.result ? (n.data.session && wx.setStorageSync("session", n.data.session), 
                    n.data.user_info && wx.setStorageSync("nickname", n.data.user_info.nickname), wx.setStorage({
                        key: "openid",
                        data: n.data.openid
                    }), n.data.wx_token && wx.setStorageSync("wx_token", n.data.wx_token), wx.setStorage({
                        key: "yz_uid",
                        data: n.data.uid
                    }), wx.removeStorageSync("new_decorate"), console.log("登录后", e), "POST" == e.method ? a._postNetWork(e) : a._getNetWork(e)) : (a.seyzredirect(), 
                    wx.showModal({
                        title: "提示",
                        content: n.data,
                        success: function(e) {
                            console.log(e);
                        }
                    }), wx.redirectTo({
                        url: "/pages/login/login"
                    }));
                }).catch(function(e) {
                    console.log(e), wx.hideLoading({
                        success: function(e) {}
                    }), console.log("第三方登录失败session、wx_token获取失败" + e.errMsg);
                }) : (a.seyzredirect(), wx.redirectTo({
                    url: "/pages/login/login"
                }));
            },
            fail: function(e) {
                wx.hideLoading({
                    success: function(e) {}
                }), wx.showToast({
                    title: "小程序需要登录，请点击右下方前往小程序体验",
                    icon: "none",
                    duration: 1500
                }), console.log("登录失败，请求被拒绝！获取用户登录态失败！" + e);
            }
        });
    },
    initLanguage: function(e) {
        try {
            wx.setStorageSync("mailLanguage", JSON.stringify(e));
        } catch (e) {
            console.log(e);
        }
        this._getLanguage(e && e.plugin_language ? e.plugin_language : _language.default);
    },
    gotochecklogin: function(e) {
        this.getfirstData(e);
    },
    getfirstData: function(e) {
        this.globalData.pathData = e.path;
    },
    qqMapTransBMap: function(e, t) {
        if (null == e || "" == e || null == t || "" == t) return {
            lng: Number(e),
            lat: Number(t)
        };
        var a = 3e3 * Math.PI / 180, n = parseFloat(e), o = parseFloat(t), i = Math.sqrt(n * n + o * o) + 2e-5 * Math.sin(o * a), r = Math.atan2(o, n) + 3e-6 * Math.cos(n * a), s = i * Math.cos(r) + .0065, l = i * Math.sin(r) + .006;
        return {
            lng: Number(s),
            lat: Number(l)
        };
    },
    BMapTransqqMap: function(e, t) {
        if (null == e || "" == e || null == t || "" == t) return {
            lng: Number(e),
            lat: Number(t)
        };
        var a = 3e3 * Math.PI / 180, n = parseFloat(e) - .0065, o = parseFloat(t) - .006, i = Math.sqrt(n * n + o * o) - 2e-5 * Math.sin(o * a), r = Math.atan2(o, n) - 3e-6 * Math.cos(n * a), s = i * Math.cos(r), l = i * Math.sin(r);
        return {
            lng: Number(s),
            lat: Number(l)
        };
    },
    tips: function(e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "none", a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 2500;
        return wx.showToast({
            title: e,
            icon: t,
            duration: a
        }), !1;
    },
    confirm: function(e, t) {
        var a = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], n = arguments.length > 3 ? arguments[3] : void 0, o = arguments.length > 4 ? arguments[4] : void 0;
        return new Promise(function(i, r) {
            wx.showModal({
                title: "提示",
                content: e,
                showCancel: a,
                confirmText: n || "确认",
                cancelTextL: o || "取消",
                success: function(e) {
                    e.confirm ? (i(!0), t && t(!0)) : e.cancel && (i(!1), t && t(!1));
                },
                fail: function() {
                    r(!1);
                }
            });
        });
    },
    setDeliver: function(e) {
        var t = wx.getStorageSync("deliverId") || null;
        if (e.query.dyID && !t) {
            if ([ "packageG/pages/category_v2/category_v2", "packageB/member/category/search_v2/search_v2" ].indexOf(e.path) > -1) return !1;
            if ([ "packageG/index/index", "packageG/newDiy/newDiy" ].indexOf(e.path) > -1) return wx.setStorageSync("deliverId", e.query.dyID), 
            !1;
            var a = this.getNetAddresss("plugin.package-deliver.frontend.decorate-deliver.getNowPackageDeliver");
            a = a + "&deliver_id=" + e.query.dyID, this._getNetWork({
                url: a,
                success: function(e) {
                    var t = e.data;
                    1 == t.result && wx.setStorageSync("deliverId", t.data.id);
                }
            });
        }
    },
    shareTimeLine: function(e) {
        var t = null, a = {}, n = {}, o = wx.getStorageSync("yz_uid"), i = null;
        if (o && "" != o && (i = o), e.onShareTimeline && (t = e.onShareTimeline()), !t) return a.query = "?mid=".concat(i), 
        a;
        var r = e.onShareTimeline;
        e.onShareTimeline = function(e) {
            return (n = r()).query && n.query.indexOf("mid") > -1 && (a.query = "".concat(n.query, "&mid=").concat(i)), 
            n.title && (a.title = n.title), n.imageUrl && (a.imageUrl = n.imageUrl), a;
        };
    },
    overShare: function() {
        var e = this;
        wx.onAppRoute(function(t) {
            var a = getCurrentPages(), n = a[a.length - 1], o = {}, i = null;
            if (e.globalData.new_page_comeIn = 1, n) try {
                if (e.shareTimeLine(n), n.onShareAppMessage && (i = n.onShareAppMessage()), 1 == e.globalData.store_alone_temp && e.globalData.STORE_ID) e.storeAloneShare(n, o, i); else {
                    var r = {}, s = wx.getStorageSync("yz_uid"), l = null;
                    if (s && "" != s && (l = s), i) {
                        var c = n.onShareAppMessage;
                        n.onShareAppMessage = function(e) {
                            if (o = c(), e && "button" == e.from) return c(e);
                            (s = wx.getStorageSync("yz_uid")) && "" != s && (l = s), o.path ? o.path.indexOf("mid") > -1 ? r.path = o.path : l && (o.path.indexOf("?") > -1 ? r.path = "".concat(o.path, "&mid=").concat(l) : r.path = "".concat(o.path, "?mid=").concat(l)) : l && (r.path = "/".concat(n.route, "?mid=").concat(l));
                            var t = wx.getStorageSync("deliverId") || null;
                            return t && (r.path = "".concat(r.path, "&dyID=").concat(t)), o.title && (r.title = o.title), 
                            o.imageUrl && (r.imageUrl = o.imageUrl), console.log("重写分享配置", r), r;
                        };
                    } else n.onShareAppMessage = function(e) {
                        return (s = wx.getStorageSync("yz_uid")) && "" != s && (l = s), r.path = "/".concat(n.route, "?mid=").concat(l), 
                        r;
                    };
                }
            } catch (e) {
                console.log("app.js报错：error:::页面" + n.route + "获取onShareAppMessage报错=============", e);
            }
        });
    },
    storeAloneShare: function(e, t, a) {
        var n = {}, o = wx.getStorageSync("yz_uid"), i = null, r = this.globalData.STORE_ID;
        if (o && "" != o && (i = o), a) {
            var s = e.onShareAppMessage;
            e.onShareAppMessage = function(a) {
                return t = s(), a && "button" == a.from ? (t.path = t.path + "&store_alone_id=".concat(r), 
                t(a)) : ((o = wx.getStorageSync("yz_uid")) && "" != o && (i = o), t.path ? t.path.indexOf("mid") > -1 ? (console.log(t.path + "&store_alone_id=".concat(r), "ddddddddddddddd"), 
                n.path = t.path + "&store_alone_id=".concat(r)) : i && (t.path.indexOf("?") > -1 ? n.path = "".concat(t.path, "&mid=").concat(i, "&store_alone_id=").concat(r) : n.path = "".concat(t.path, "?mid=").concat(i, "&store_alone_id=").concat(r), 
                console.log(t.path + "&store_alone_id=".concat(r), "ddddddddddddddd22")) : i && (n.path = "/".concat(e.route, "?mid=").concat(i, "&store_alone_id=").concat(r), 
                console.log(t.path + "&store_alone_id=".concat(r), "ddddddddddddddd33")), t.title && (n.title = t.title), 
                t.imageUrl && (n.imageUrl = t.imageUrl), console.log("重写分享配置", n), n);
            };
        } else e.onShareAppMessage = function(t) {
            return (o = wx.getStorageSync("yz_uid")) && "" != o && (i = o), n.path = "/".concat(e.route, "?mid=").concat(i, "&store_alone_id=").concat(r), 
            n;
        };
    },
    getReverseGeocoder: function(e, t) {
        var a = this;
        return new Promise(function(n, o) {
            if (a.globalData.location && a.globalData.location.latitude == e && a.globalData.location.longitude == t) return console.log("当前定位位置未发生改变，取globalData里值 》》》》》》》》》》》", a.globalData.location), 
            void n(a.globalData.geocoder);
            a.globalData.qqmapkey ? (qqmapsdk = new QQMapWX({
                key: a.globalData.qqmapkey
            })).reverseGeocoder({
                location: {
                    latitude: e,
                    longitude: t
                },
                sig: a.globalData.qqmapsig,
                success: function(o) {
                    var i = o.result;
                    a.globalData.location = {
                        latitude: e,
                        longitude: t
                    }, a.globalData.geocoder = i, console.log("当前定位位置发生改变!!!!!!!重新reverseGeocoder()", a.globalData.location), 
                    n(i);
                },
                fail: function(e) {
                    wx.showToast({
                        duration: 3e3,
                        title: e.message,
                        icon: "none"
                    }), o("app.getReverseGeocoder()报错error::::", e);
                },
                complete: function(e) {}
            }) : o("没有that.globalData.qqmapkey::::", a.globalData.qqmapkey);
        });
    },
    getGeocoder: function(e) {
        var t = this;
        return new Promise(function(a, n) {
            t.globalData.qqmapkey ? (qqmapsdk = new QQMapWX({
                key: t.globalData.qqmapkey
            })).geocoder({
                address: e,
                sig: t.globalData.qqmapsig,
                success: function(e) {
                    var t = e.result, n = {
                        lat: t.location.lat,
                        lng: t.location.lng
                    };
                    a(n);
                },
                fail: function(e) {
                    wx.showToast({
                        duration: 3e3,
                        title: e.message,
                        icon: "none"
                    }), n("app.getGeocoder()报错error::::", e);
                },
                complete: function(e) {}
            }) : n("没有that.globalData.qqmapkey::::", t.globalData.qqmapkey);
        });
    },
    resetBasicInfo: function() {
        yzFirstlogin = 1;
    },
    watchGlobalData: function(e, t) {
        var a = this.globalData;
        Object.defineProperty(a, e, {
            configurable: !0,
            enumerable: !0,
            set: function(e) {
                this.key = e, t(e);
            },
            get: function() {
                return this.key;
            }
        });
    },
    adConfig: {
        app_id: _host.default.adBrightid || "",
        domain: _host.default.adBrightDomain || "",
        test_id: "",
        h5_path: "/packageI/web-view/h5View"
    }
});